#ifndef __AS5047_H
#define __AS5047_H

#include "main.h"
#include <stdio.h>
#include <string.h>

#define tag1 0x20
#define tag2 0x25
#define MAX_SIZE        256

typedef struct
{
  float YAW; //码盘陀螺仪的YAW值
  float X_W_t;//码盘解算的世界坐标系X坐标
  float Y_W_t;//码盘解算的世界坐标系Y坐标
}AS5047_t;

typedef struct
{
  uint8_t address;/*当前指针的位置*/
  uint16_t len;/*数据帧的长度*/
  AS5047_t AS5047_data;
  uint8_t buff[MAX_SIZE];
}AS5047_raw_t;

void AS5047_Init(AS5047_raw_t* AS_5047);  
int SYNC(AS5047_raw_t* AS_5047,uint8_t rx_data);
int check(AS5047_raw_t* AS_5047,uint8_t rx_data);
int decode(AS5047_raw_t* AS_5047);
#endif
